+2006-03-01 Kristian Rietveld <kris@imendio.com>
+
+ * gtk/gtktreeselection.c (row_is_selectable): rename to
+ _gtk_tree_selection_row_is_selectable and export internally,
+ (gtk_tree_selection_real_select_node): changed so it is always
+ possible to unselect insensitive nodes, changed the logic a bit to
+ be more clear.
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_selection_row_is_selectable.
+
+ * gtk/gtktreeview.c (gtk_tree_view_row_changed): Unselect a row if
+ it became insensitive.
+
2006-02-27 Federico Mena Quintero <federico@novell.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that
+2006-03-01 Kristian Rietveld <kris@imendio.com>
+
+ * gtk/gtktreeselection.c (row_is_selectable): rename to
+ _gtk_tree_selection_row_is_selectable and export internally,
+ (gtk_tree_selection_real_select_node): changed so it is always
+ possible to unselect insensitive nodes, changed the logic a bit to
+ be more clear.
+
+ * gtk/gtktreeprivate.h: add _gtk_tree_selection_row_is_selectable.
+
+ * gtk/gtktreeview.c (gtk_tree_view_row_changed): Unselect a row if
+ it became insensitive.
+
2006-02-27 Federico Mena Quintero <federico@novell.com>
* gtk/gtkfontsel.c (gtk_font_selection_set_font_name): Check that
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
GtkTreeView *tree_view);
+gboolean _gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
+ GtkRBNode *node,
+ GtkTreePath *path);
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
GdkWindow *window,
return sensitive;
}
-static gboolean
-row_is_selectable (GtkTreeSelection *selection,
- GtkRBNode *node,
- GtkTreePath *path)
+gboolean
+_gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
+ GtkRBNode *node,
+ GtkTreePath *path)
{
GList *list;
GtkTreeIter iter;
{
/* We only want to select the new node if we can unselect the old one,
* and we can select the new one. */
- dirty = row_is_selectable (selection, node, path);
+ dirty = _gtk_tree_selection_row_is_selectable (selection, node, path);
/* if dirty is FALSE, we weren't able to select the new one, otherwise, we try to
* unselect the new one
GtkRBNode *node,
gboolean select)
{
- gboolean selected = FALSE;
+ gboolean toggle = FALSE;
GtkTreePath *path = NULL;
select = !! select;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED) != select)
{
path = _gtk_tree_view_find_path (selection->tree_view, tree, node);
- selected = row_is_selectable (selection, node, path);
+ if (!select)
+ toggle = TRUE;
+ else
+ toggle = _gtk_tree_selection_row_is_selectable (selection, node, path);
gtk_tree_path_free (path);
}
- if (selected == TRUE)
+ if (toggle)
{
node->flags ^= GTK_RBNODE_IS_SELECTED;
if (tree == NULL)
goto done;
+ /* Check if the node became insensitive, and if so, unselect it */
+ if (!_gtk_tree_selection_row_is_selectable (tree_view->priv->selection,
+ node, path))
+ gtk_tree_selection_unselect_path (tree_view->priv->selection, path);
+
if (tree_view->priv->fixed_height_mode
&& tree_view->priv->fixed_height >= 0)
{